package view.render.monster
{
	import enums.main.UISize;
	
	import feathers.controls.Label;
	
	import model.vo.monster.LMonsterAppearVo;
	
	import view.render.BaseScrollerItem;
	
	
	/**
	 * 大型怪物-出现任务列表item
	 * @author £iang
	 * 
	 */	
	public class LMonsterAppearListItem extends BaseScrollerItem
	{
		//-----------------------------
		// variables
		//-----------------------------
		
		/** 区别信息 */
		public var distinctionLabel:Label;
		/** 难度信息 */
		public var levelLabel:Label;
		/** 血量信息 */
		public var hpLabel:Label;
		/** 攻击倍率信息 */
		public var attackLabel:Label;
		/** 防御倍率信息 */
		public var defenceLabel:Label;
		/** 硬直倍率信息 */
		public var fearLabel:Label;
		/** 备注信息 */
		public var psLabel:Label;
		
		//-----------------------------
		// properties
		//-----------------------------
		
		//-----------------------------
		// setter&getter
		//-----------------------------
		
		//-----------------------------
		// methods
		//-----------------------------
		
		/**
		 * 初始化函数 
		 * 
		 */		
		override protected function initializeOther():void
		{
			super.initializeOther();
			distinctionLabel = new Label();
			distinctionLabel.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( distinctionLabel );
			
			levelLabel = new Label();
			levelLabel.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( levelLabel );
			
			hpLabel = new Label();
			hpLabel.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( hpLabel );
			
			attackLabel = new Label();
			attackLabel.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( attackLabel );
			
			defenceLabel = new Label();
			defenceLabel.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( defenceLabel );
			
			fearLabel = new Label();
			fearLabel.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( fearLabel );
			
			psLabel = new Label();
			psLabel.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( psLabel );
			
		}
		
		/**
		 * 调整组件 
		 * 
		 */		
		override protected function draw():void
		{
			var labelY:Number = ( _itemH - 
				43 ) / 2 * UISize.DPI_SCALE;
			var leftPadding:Number = UISize.TITLE_PADDING_LEFT * UISize.DPI_SCALE;
			var firstLabelFullW:Number;
			
			firstLabel.x = leftPadding;
			firstLabelFullW = UISize.MAIN_W * _firstPercent;
			
			distinctionLabel.y = labelY;
			distinctionLabel.x = 0;
			distinctionLabel.width  = UISize.MAIN_W * 0.2;
			
			levelLabel.y = labelY;
			levelLabel.x = UISize.MAIN_W * 0.2;
			levelLabel.width  = UISize.MAIN_W * 0.2;
			
			hpLabel.y = labelY;
			hpLabel.x = UISize.MAIN_W * 0.4;
			hpLabel.width  = UISize.MAIN_W * 0.2;
			
			attackLabel.y = labelY;
			attackLabel.x = UISize.MAIN_W * 0.6;
			attackLabel.width  = UISize.MAIN_W * 0.2;
			
			defenceLabel.y = labelY;
			defenceLabel.x = UISize.MAIN_W * 0.8;
			defenceLabel.width  = UISize.MAIN_W * 0.2;
			
			fearLabel.y = labelY;
			fearLabel.x = UISize.MAIN_W * 1;
			fearLabel.width  = UISize.MAIN_W * 0.2;
			
			psLabel.y = labelY;
			psLabel.x = UISize.MAIN_W * 1.2;
			psLabel.width  = UISize.MAIN_W * 0.6;
			
			scollerContainer.x = firstLabelFullW;
			scollerContainer.height = _itemH * UISize.DPI_SCALE;
			scollerContainer.width = UISize.MAIN_W - firstLabelFullW;
			
			this.width = UISize.MAIN_W;
			this.height = _itemH * UISize.DPI_SCALE;
		}
		
		/**
		 * 设置item数据 
		 * @param data 数据
		 * 
		 */		
		public function setData( data:LMonsterAppearVo ):void
		{
			firstLabel.text = data.quest;
			distinctionLabel.text = data.distinction;
			levelLabel.text = data.level;
			hpLabel.text = data.hp;
			attackLabel.text = data.attack;
			defenceLabel.text = data.defence;
			fearLabel.text = data.fear;
			psLabel.text = data.ps;
		}
		
		//-----------------------------
		// events
		//-----------------------------
		
		//-----------------------------
		// dispose
		//-----------------------------
		
		/**
		 * 析构函数 
		 * 
		 */		
		protected override function disposeAnythingInContainer():void
		{
			disposeLabels( [
				"distinction", "level", "hp",
				"attack", "defence", "fear", 
				"ps"
			] );
		}
		
		//-----------------------------
		// construction
		//-----------------------------
		
		/**
		 * 构造函数
		 *
		 */
		public function LMonsterAppearListItem()
		{
			super();
			_itemH = UISize.LMONSTER_AP_ITEM_H;
			_firstPercent = 0.4;
			initialize();
		}
	}
}